<?php if ($error != ''): ?>
    <ul class="message error">
        <?php if ($error != ''): ?>
            <li><?php echo $error ?></li>
        <?php endif; ?>
        <?php echo form_error('phone') ?>
        <?php echo form_error('network') ?>
    </ul>
<?php endif; ?>
<form class="form has-validation" method="POST" action="">
    <input type="hidden" name="frmToken" id="frmToken" value="<?php echo $frmToken ?>"/>
    <div class="clearfix">
        <label for="form-phone" class="form-label">Số điện thoại<em>*</em><small>Nhập số điện thoại sim</small></label>
        <div class="form-input"><input type="text" id="form-phone" name="phone" value="<?php echo $all[0]['phone'];?>" required="required"></div>
    </div>

    <div class="clearfix">
        <label for="form-network" class="form-label">Loại mạng<em>*</em><small>Sim thuộc mạng</small></label>
        <div class="form-input">
            <select id="form-network" name="network" required="required">
                <option value="">-Chọn nhà cung cấp-</option>
                <?php foreach ($listNetwork as $n): ?>
                <option value="<?php echo $n['id'];?>" <?php echo ($all[0]['list_network_id'] == $n['id']) ? "selected='selected'" : ""?>>Mạng <?php echo $n['name'] ?></option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>

    <div class="clearfix">
        <label for="form-city" class="form-label">Đại lý<small>Sim thuộc đại lý</small></label>
        <div class="form-input">
            <select id="form-city" name="city">
                <option value="">-Chọn đại lý-</option>
                <?php foreach ($listCity as $c): ?>
                    <option value="<?php echo $c['id'] ?>" <?php echo $all[0]['list_city_id'] == $c['id'] ? "selected='selected'" : ""?>><?php echo $c['name'] ?></option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>

    <div class="clearfix">
        <label for="form-group" class="form-label">Nhóm sim<small>Sim thuộc nhóm</small></label>
        <div class="form-input">
            <select id="form-group" name="group">
                <option value="">-Chọn nhóm sim-</option>
                <?php foreach ($listGroup as $g): ?>
                    <option value="<?php echo $g['id'];?>" <?php echo $all[0]['list_group_id'] == $g['id'] ? "selected='selected'" : ""?> ><?php echo $g['name'] ?></option>
                <?php endforeach; ?>
            </select>
        </div>
    </div>

    <div class="clearfix">
        <label for="form-price" class="form-label" >Giá tiền<em>*</em><small>Nhập giá tiền của số điện thoại</small></label>
        <div class="form-input">
            <input style="width: 100px" type="text" id="form-price" name="price" required="required" value="<?php echo $all[0]['price_update']?>" /> <span style="color: red">VNĐ</span>
        </div>
    </div>

    <div class="form-action clearfix">
        <input class="button" type="submit" name="submit" data-icon-primary="ui-icon-circle-check" value="OK"/>
        <input class="button" type="reset" value="Nhập lại"/>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function() {
        $('#form-price').setMask({
            mask: '999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.99',
            type: 'reverse',
            defaultValue: '0',
            textAlign : false
        });
        function validateNumber(event) {
    var key = window.event ? event.keyCode : event.which;

    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39) {
        return true;
    }
    else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
};
    $('#form-phone').keypress(validateNumber);
    });
</script>